<template>
	<m-layout title="反馈记录">
		
		<template v-for="(item,index) in listArr">
			<m-block :key="index" gap="24" spa="0 0 24 0">
				<view class="flex-between">
					<m-text >{{item.ctime | times}}</m-text>
					<m-text :color="item.state == 1?'var(--success)':'var(--error)'">{{item.state == 1?"已处理":'未处理'}}</m-text>
				</view>
				<view class="flex-between" style="align-items: flex-start; padding-top: 20rpx;">
					<m-text block gap="6 0 0">反馈内容：</m-text>
					<m-text style="flex:1" className="flex-1" color="#999" ftsize="26">{{item.content}}</m-text>
				</view>
				<view class="flex-between" style="align-items: flex-start; padding-top: 20rpx;" v-if="item.state == 1">
					<m-text block  gap="6 0 0">回复内容：</m-text>
					<m-text style="flex:1" className="flex-1" color="#999" ftsize="26">{{item.replycontent}}</m-text>
				</view>
			</m-block>
		</template>
		<m-loading :pageIndex="pageIndex" :pageCount="pageCount" :loading="isLoading" />
	</m-layout>
</template>

<script>
	import { Feedback_GetMsg } from '@/api/Ctrls.js'
	export default {
		data() {
			return {
				tabIdx: 0,
				listArr: [],
				pageIndex: 1,
				pageCount: 1,
				isLoading: true,
			};

		},
		onLoad() {
			this.reset()
		},
		methods: {
			reset() {
				this.pageCount = 1;
				this.pageIndex = 1;
				this.getData();
			},
			async getData() {
				if (this.pageIndex > this.pageCount) {
					return
				}
				this.isLoading = true;
				const { list, pageCount } = await Feedback_GetMsg({
					PageIndex: this.pageIndex,
				});
				this.isLoading = false;
				this.pageCount = pageCount;
				if (this.pageIndex <= 1) {
					this.listArr = list;
				} else {
					this.listArr = [...this.listArr, ...list];
				}
				this.pageIndex++;
				uni.stopPullDownRefresh();
			},
		},
		onPullDownRefresh() {
			this.reset();
		},
		onReachBottom() {
			this.getData();
			console.log("触底了");
		},
	}
</script>

<style lang="scss">

</style>